﻿#region Using Directives

    using System;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Private
{
    /// <summary>
    /// This class represents an indiviual Payment that is assigned to an Assignment during it's lifecycle.
    /// This class has no data access factory and as such cannot be persisted outside of an Assignment object. 
    /// 
    /// Instances of this object belong to a Assignment object and their persistence and general management are handled by their owner (Assignment object).
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.AssignmentFactory, MarketPulse.DataAccess.Factory", "CreatePayment", "")]
    public class AssignmentPayment : MarketPulseBase<AssignmentPayment>
    {
        #region Member Variables

            /// <summary>
            /// The Guid of the associated Assignment 
            /// </summary>
            public static PropertyInfo<Nullable<Guid>> mAssignmentGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.AssignmentGuid);

            /// <summary>
            /// The Version ID of the associated Assigment. When used in conjunction with the Guid, this
            /// uniquely identifies the assocaited Assignment
            /// </summary>
            public static PropertyInfo<Nullable<long>> mAssignmentVersionIdProperty = RegisterProperty<Nullable<long>>(p => p.AssignmentVersionId);

            /// <summary>
            /// The GUID of the associated AssignmentEventType
            /// </summary>
            public static PropertyInfo<Nullable<Guid>> mAssignmentPaymentTypeGuidProperty = RegisterProperty<Nullable<Guid>>(p => p.AssignmentPaymentTypeGuid);

            /// <summary>
            /// The amount of this AssignmentPayment
            /// </summary>
            public static PropertyInfo<Nullable<double>> mPaymentAmountProperty = RegisterProperty<Nullable<double>>(p => p.Amount);

        #endregion

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private AssignmentPayment()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method that creates a new AssignmentPayment via the DataPortal client proxy
                /// </summary>
                /// <returns>The newly created Assignment object</returns>
                public static AssignmentPayment New()
                {
                    return DataPortal.Create<AssignmentPayment>();
                }

            #endregion

        #endregion

        #region Properties

            /// <summary>
            /// The Guid of the associated Assignment 
            /// </summary>
            public Nullable<Guid> AssignmentGuid
            {
                get { return GetProperty(mAssignmentGuidProperty); }
                set { SetProperty(mAssignmentGuidProperty, value); }
            }

            /// <summary>
            /// The Version ID of the associated Assigment. When used in conjunction with the Guid, this
            /// uniquely identifies the assocaited Assignment
            /// </summary>
            public Nullable<long> AssignmentVersionId
            {
                get { return GetProperty(mAssignmentVersionIdProperty); }
                set { SetProperty(mAssignmentVersionIdProperty, value); }
            }

            /// <summary>
            /// The Guid of the associated AssignmentPaymentType
            /// </summary>
            public Nullable<Guid> AssignmentPaymentTypeGuid
            {
                get { return GetProperty(mAssignmentPaymentTypeGuidProperty); }
                set { SetProperty(mAssignmentPaymentTypeGuidProperty, value); }
            }

            /// <summary>
            /// The amount of this AssignmentPayment
            /// </summary>
            public Nullable<double> Amount
            {
                get { return GetProperty(mPaymentAmountProperty); }
                set { SetProperty(mPaymentAmountProperty, value); }
            }

        #endregion

    }
}
